<ul class="nav nav-stacked oc-sidebar-nav" id="collapseNavbarLeft2">

    <li ng-repeat="(m1index,m1) in menus" ng-class="{dropdown:(m1.leaf != 1),active:(activeIndex==m1index)}">
        <a ng-class="{collapsed:selectedIndexes[0]!=m1index}"
           data-toggle="collapse"
           data-parent="#collapseNavbarLeft2"
           rel="popover-sidebar"
           data-container="body"
           data-placement="right"
           data-content="{{m1.menuName}}"
           ng-click="pathTo(m1index+'',m1.leaf)"
           href="#uid_{{m1index}}">

            <i class="oc-partial-icon icm {{m1.iconClass}}"></i>

            <span class="oc-partial-menu-item">
                {{m1.menuName}}
                <b class="caret" ng-if="m1.leaf != 1"></b>
            </span>
        </a>

        <ul ng-if="m1.leaf != 1" class="collapse dropdown-menu "
            ng-class="{in:selectedIndexes[0]==m1index}"
            id="uid_{{m1index}}" >
            <li ng-repeat="(m2index,m2) in m1.children" ng-class="{dropdown:(m2.leaf != 1),active:(activeIndex==m1index+'_'+m2index)}">
                <a ng-class="{collapsed:(selectedIndexes[0]+'_'+selectedIndexes[1]!=m1index+'_'+m2index)}"
                   data-toggle="collapse"
                   data-parent="#uid_{{m1index}}"
                   ng-click="pathTo(m1index+'_'+m2index,m2.leaf)"
                   href="#uid_{{m1index}}_{{m2index}}">
                    {{m2.menuName}}
                    <b class="caret" ng-if="m2.leaf != 1"></b>
                </a>

                <ul class="collapse dropdown-menu " ng-if="m2.leaf != 1"
                    ng-class="{in:selectedIndexes[0]+'_'+selectedIndexes[1]==m1index+'_'+m2index}"
                    id="uid_{{m1index}}_{{m2index}}">

                    <li ng-class="{active:activeIndex==m1index+'_'+m2index+'_'+m3index}" ng-repeat="(m3index,m3) in m2.children">
                        <a href="javascript:;" id="uid_{{m1index}}_{{m2index}}_{{m3index}}"
                           ng-click="pathTo(m1index+'_'+m2index+'_'+m3index,m3.leaf)">
                            {{m3.menuName}}
                        </a>
                    </li>

                </ul>
            </li>

        </ul>

    </li>

</ul>